{ INFORMATICS.MCCME.RU
  Problem statement: http://informatics.mccme.ru/moodle/mod/statements/view3.php?chapterid=1435
  Verdict: Accepted
}
uses SysUtils, Math;
 
var
	kk,tt,code:longint;
	s,t:string;
	f:boolean;
 
begin
reset(input,'input.txt');
rewrite(output,'output.txt');
readln(S);
kk:=pos('.',s);   
f:=true;
while kk>0 do begin
	t:=copy(s,1,kk-1);
	if length(t)=0 then begin
		f:=false;
		break;
	end;
	Val(t,tt,code);
	if code>0 then begin
		f:=false;
		break;
	end else
	if not((tt>=0) and (tt<=255)) then begin
		f:=false;
		break;
	end;
	delete(S,1,kk);
	kk:=pos('.',s);
end;
if length(S)=0 then f:=false else 
if f then begin
	Val(s,tt,kk);
	if kk>0 then f:=false else
	if not((tt>=0) and (tt<=255)) then f:=false;
end;
if f then write(1) else write(0);
end.